/**
 * 
 */
package com.threedt.nova.portfolio.controller;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.threedt.nova.portfolio.pojo.NewsItem;
import com.threedt.nova.portfolio.reader.SimpleFeedReader;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.core.Message;

/**
 * @author vivek barsagadey
 * 
 */
public class LeatesNewsPoll implements Serializable {

	private Boolean enable = true;;
	private List<NewsItem> newsList;

	@Autowired(required = true)
	private SimpleFeedReader simpleFeedReader;

	private void loadNews() {
		newsList = new ArrayList<NewsItem>();

		try {
			newsList= simpleFeedReader.receive();

		} catch (Exception e) {

		}

	}

	public Boolean getEnable() {
		return enable;
	}

	public void setEnable(Boolean enable) {
		this.enable = enable;
	}

	public void start() {
		enable = true;
	}

	public void stop() {
		enable = false;
	}

	public List<NewsItem> getNewsList() {
		loadNews();
		return newsList;
	}

	public void setNewsList(List<NewsItem> newsList) {
		this.newsList = newsList;
	}

}
